<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\facade\Db;

/**
 * @mixin \think\Model
 */
class Config extends Model
{
    /**
     * 获取表字段
     * @param bool $isPk 是否获取主键
     *
     * @return array
     */
    public function getFields(bool $isPk=false):array{
        $fields = array_keys(Db::table($this->getTable())->getFields());
        if(!$isPk){
            $pk = $this->getPk();
            foreach ($fields as $k=>$f){
                if($f === $pk){
                    unset($fields[$k]);
                }
            }
        }

        return $fields;
    }



}
